package com.chinasoft.reposearch.util;

import com.chinasoft.reposearch.RepoSearchApplication;
import com.chinasoft.reposearch.service.DataCountService;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

public class CountDataNow {
    public static void main(String[] args) throws InterruptedException {
        AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(RepoSearchApplication.class);
        DataCountService dataCountService = context.getBean(DataCountService.class);

        Thread thread1 = new Thread(dataCountService::countLanguage);
        Thread thread2 = new Thread(dataCountService::countTopic);
        Thread thread3 = new Thread(dataCountService::dumpToMysql);

        thread1.start();
        thread2.start();
        thread1.join();
        thread2.join();
        thread3.start();
    }
}
